//Function:To calculate the average of a array of number
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::fixed;

#include <iomanip>
using std::setprecision;

int main()
{
	int total = 0;
	int gradeCounter = 0;
	int grade = 0;
	double average = 0;
	
	cout << "Please enter the grade, -1 to end."<<endl;
	cin >> grade;
	while(grade != -1)
	{
		total += grade;
		gradeCounter++;
		cout << "Please enter the grade, -1 to end."<<endl;
		cin >> grade;
	}
	if (gradeCounter != 0)
	{
		average = static_cast<double>(total) / gradeCounter;
		cout << "The average is: " << fixed << setprecision(3) << average << endl;
	}
	else
		cout << "No grades were enter."<<endl;
	
	return 0;
	
}
